<template>
  <div class="page-container">
    <SearchPanel @change="handleSearchPanelChange">
      <el-form
        ref="queryForm"
        class="query-more-form"
        size="mini"
        label-width="100px"
        :model="query"
      >
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="信用代码">
              <el-input
                v-model="query.inifiedCreditCode"
                class="search-ipt"
                placeholder="请输入统一信用代码"
                maxlength="255"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="企业名称">
              <el-input
                v-model="query.unitName"
                class="search-ipt"
                placeholder="请输入企业名称"
                maxlength="255"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="法人">
              <el-input
                v-model="query.legalPerson"
                class="search-ipt"
                placeholder="请输入法人"
                maxlength="255"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6" class="btn-col">
            <el-button size="mini" class="search-btn" @click="handleSelect">查询</el-button>
          </el-col>
        </el-row>
      </el-form>
    </SearchPanel>
    <div class="table-container">
      <div class="table-tools-panel table-flex-row">
        <el-button class="flush-btn" size="mini" icon="el-icon-refresh" @click="handleSelect"
          >刷新</el-button
        >
        <div>
          <el-button
            class="tools-btn"
            size="mini"
            icon="el-icon-set-up"
          ></el-button>
          <el-button
            class="tools-btn"
            size="mini"
            icon="el-icon-share"
          ></el-button>
          <el-button
            class="tools-btn"
            size="mini"
            icon="el-icon-printer"
          ></el-button>
        </div>
      </div>
      <div class="table-list-panel">
        <el-table
          v-loading="tableLoading"
          border
          size="small"
          :data="tableData"
          :height="isShow ? 'calc(100vh - 465px)' : 'calc(100vh - 335px)'"
          style="width: 100%"
        >
          <el-table-column type="selection" width="45" />
          <el-table-column prop="inifiedCreditCode" label="统一社会信用代码" show-overflow-tooltip />
          <el-table-column prop="unitName" label="企业名称" show-overflow-tooltip />
          <el-table-column prop="legalPerson" label="法人" show-overflow-tooltip />
          <el-table-column prop="registerDate" label="注册时间" show-overflow-tooltip />
          <!-- <el-table-column prop="openingDate" label="注册时间" show-overflow-tooltip /> -->
          <!-- <el-table-column prop="key5" label="注册资本" show-overflow-tooltip />
          <el-table-column prop="key5" label="营业期限" show-overflow-tooltip /> -->
          <el-table-column prop="registeredDistrict" label="注册地址" show-overflow-tooltip>
              <template slot-scope="scope">
                <div>{{  scope.row.registeredDistrict }}{{  scope.row.registeredStreet }}</div>
              </template>
          </el-table-column>
          <el-table-column prop="industry" label="经营范围" show-overflow-tooltip />
          <el-table-column prop="fillingStatus" label="状态" show-overflow-tooltip />
          <el-table-column label="操作" width="120" fixed="right">
            <template slot-scope="scope">
              <el-button
                class="table-inner-btn"
                type="text"
                size="mini"
                @click="handDetail(scope.row)"
                >详情</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="pagination-panel">
        <Pagination
          :total="query.total"
          :page.sync="query.pageNum"
          :limit.sync="query.pageSize"
          @pagination="initData"
        />
      </div>
    </div>
  </div>
</template>

<script>
import SearchPanel from "@/components/SearchPanel";
import Pagination from "@/components/Pagination";
import { getPage } from '@/api/performanceSupport/supervise'
export default {
  name: "CaseDealDispatch",
  components: {
    SearchPanel,
    Pagination,
  },
  data() {
    return {
      query: {
        inifiedCreditCode: null,
        unitName: null,
        legalPerson: null,
        total: 0,
        pageNum: 1,
        pageSize: 10,
      },
      tableLoading: false,
      tableData: [],
      isShow: true,
    };
  },
  created() {
    this.initData()
  },
  methods: {
    handleSearchPanelChange(flag) {
      this.isShow = flag;
    },
    initData() {
      this.handleSelect()
    },
    handleSelect() {
      this.tableLoading = true
      getPage(this.query).then(res => {
        this.tableData = res.rows
        this.query.total = res.total
        this.tableLoading = false
      }).catch(() => {
        this.tableLoading = false
      })
    },
    // 详情
    handDetail(row) {
      // getOne(row.id).then((res) => {
      //   this.dialogType = "detail";
      //   this.visible = true;
      //   this.obj = JSON.parse(JSON.stringify(res.data));
      // });
    },
  },
};
</script>

<style lang="scss" scoped>
</style>